﻿using MongoDB.Bson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WanPiJie.Products;

namespace WanPiJie.Products
{
    public interface ICommodityService
    {
        /// <summary>
        /// MongoDB中是否存在指定的商品
        /// </summary>
        /// <param name="catalogId">商品类目Id</param>
        /// <param name="serialNumber">商品编号</param>
        /// <returns>BsonDocument：存在；Null：不存在</returns>
        BsonDocument HasCommodity(Int64 serialNumber);

        /// <summary>
        /// 更新商品数据至Mongo数据库
        /// </summary>
        /// <param name="commodity">商品对象</param>
        void Update(Commodity commodity);

        /// <summary>
        /// 添加商品数据至Mongo数据库
        /// </summary>
        /// <param name="commodity">商品对象</param>
        void Insert(Commodity commodity);

        /// <summary>
        /// 根据生日获取牛奶信息
        /// </summary>
        /// <param name="ageDays">宝贝成长天数</param>
        /// <returns></returns>
        List<Commodity> GetMilkByBirthday(int ageDays, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        ///  根据孩子的生日获取相应的奶嘴信息
        /// </summary>
        /// <param name="ageDays">宝贝成长天数</param>
        /// <param name="pageIndex">页代码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        List<Commodity> GetNippleByBirthday(int ageDays, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 根据体重获取纸尿裤信息
        /// </summary>
        /// <param name="weight">体重</param>
        /// <param name="gender">性别</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        List<Commodity> GetDiapersByWeight(float weight, string gender, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 获取奶瓶信息
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>指定页码的奶瓶信息</returns>
        List<Commodity> GetMilkBottle(Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 获取与用户宝宝信息匹配的商品信息
        /// </summary>
        /// <param name="weight">体重（千克）</param>
        /// <param name="birthday">生日</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        List<Commodity> GetCommodities(float weight, int ageDays, string gender, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 根据指定的分类和条件获取商品信息
        /// </summary>
        /// <param name="catalogId">商品分类Id</param>
        /// <param name="weight">宝宝体重</param>
        /// <param name="birthday">宝宝生日</param>
        /// <param name="pageIndex">页码号</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        List<Commodity> GetCommodities(long catalogId, float weight, int ageDays, string gender, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 分页获取商品信息
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>指定页码，指定数量的商品信息</returns>
        List<Commodity> GetCommodities(int pageIndex, int pageSize);

        /// <summary>
        ///跳过指定的记录分页获取商品信息
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>指定页码，指定数量的商品信息</returns>
        List<Commodity> GetCommodities(int skip, int pageIndex, int pageSize);

        /// <summary>
        ///分页 获取指定类目的所有商品
        /// </summary>
        /// <param name="catalogId">类目Id</param>
        /// <param name="pageIndex">页面号</param>
        /// <param name="pageSize">页面大小</param>
        /// <returns>返回指定类目的商品</returns>
        List<Commodity> GetCommodities(Int64 catalogId, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 根据所属产品去获取相应的商品信息
        /// </summary>
        /// <param name="productId">产品Id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        List<Commodity> GetCommoditiesByProduct(Int64 productId, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        ///跳过指定的记录分页获取指定类目的所有商品
        /// </summary>
        /// <param name="catalogId">类目Id</param>
        /// <param name="pageIndex">页面号</param>
        /// <param name="pageSize">页面大小</param>
        /// <returns>返回指定类目的商品</returns>
        List<Commodity> GetCommodities(Int64 catalogId, Int32 skip, Int32 pageIndex, Int32 pageSize);

        /// <summary>
        /// 根据产品编号获取产品信息
        /// </summary>
        /// <param name="serialNumber">产品编号</param>
        /// <returns></returns>
        Commodity GetCommodity(Int64 serialNumber);

        /// <summary>
        /// 获取指定商品的关联商品
        /// </summary>
        /// <param name="salesInfoExtension">指定的商品对象</param>
        /// <returns></returns>
        List<Commodity> GetRelatedCommodities(Commodity salesInfoExtension, Int32 pageIndex, Int32 pageSize);
    }
}
